import { Routes } from '@angular/router'

import { LoginComponent } from '@/app/views/login/login.component'
import { BaseComponent } from '@/app/layout/base/base.component'
import { DashboardComponent } from '@/app/views/dashboard/dashboard.component'
import { DocComponent } from '../views/doc/doc.component'
import { OfficeComponent } from '../views/pages/office/office.component'
import { PdfComponent } from '../views/pages/pdf/pdf.component'
import { MarkdownComponent } from '../views/components/markdown/markdown.component'
import { TextEditorComponent } from '../views/components/text-editor/text-editor.component'

const routeComponents = [
  DashboardComponent,
  DocComponent,
  OfficeComponent,
  PdfComponent,
  MarkdownComponent,
  TextEditorComponent,
]

const routesApp: Routes = [
  {
    path: 'login',
    component: LoginComponent,
    data: {
      title: 'Login Page',
      hidden: true,
    },
  },
  {
    path: '',
    redirectTo: 'dashboard',
    data: {
      maxLevel: 0,
      hidden: true,
    },
    pathMatch: 'full'
  },
  {
    path: '',
    component: BaseComponent,
    data: {
      maxLevel: 1,
    },
    children: [
      // {
      //   path: 'dashboard',
      //   redirectTo: 'dashboard',
      //   pathMatch: 'full',
      //   data: { title: '公告板', icon: 'dashboard' },
      // },
      {
        path: 'dashboard',
        component: DashboardComponent,
        data: { title: '公告板', icon: 'dashboard' },
      },
    ],
  },
  {
    path: '',
    component: BaseComponent,
    data: {
      maxLevel: 1,
    },
    children: [
      {
        path: 'doc',
        component: DocComponent,
        data: { title: '文档', icon: 'file-text' },
      },
    ],
  },
  {
    path: 'components',
    component: BaseComponent,
    data: {
      title: '组件',
      icon: 'appstore',
    },
    children: [
      {
        path: 'markdown',
        component: MarkdownComponent,
        data: { title: 'Markdown', icon: 'file-markdown' },
      },
      {
        path: 'editor',
        component: TextEditorComponent,
        data: { title: 'Editor', icon: 'codepen' },
      },
    ],
  },
  {
    path: 'pages',
    component: BaseComponent,
    data: {
      title: '页面',
      icon: 'global',
    },
    children: [
      {
        path: 'office',
        component: OfficeComponent,
        data: { title: 'Office', icon: 'file-word' },
      },
      {
        path: 'pdf',
        component: PdfComponent,
        data: { title: 'Pdf', icon: 'file-pdf' },
      },
    ],
  },
  {
    path: 'error',
    component: BaseComponent,
    data: {
      title: '错误页',
      icon: 'file-unknown',
    },
    children: [
      {
        path: '404',
        component: OfficeComponent,
        data: { title: '404', icon: 'file' },
      },
      {
        path: '403',
        component: PdfComponent,
        data: { title: '403', icon: 'file' },
      },
    ],
  },
  // {
  //   path: '',
  //   redirectTo: 'login',
  //   pathMatch: 'full',
  // },
]

export { routesApp, routeComponents, }


